package com.hz.monitoring.module.hardware.dal.mysql.warning_contact;

import java.util.*;

import com.hz.monitoring.framework.common.pojo.PageResult;
import com.hz.monitoring.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hz.monitoring.framework.mybatis.core.mapper.BaseMapperX;
import com.hz.monitoring.module.hardware.dal.dataobject.sensor_tenant_resource.SensorTenantResourceDO;
import com.hz.monitoring.module.hardware.dal.dataobject.warning_contact.WarningContactDO;
import org.apache.ibatis.annotations.Mapper;
import com.hz.monitoring.module.hardware.controller.admin.warning_contact.vo.*;

/**
 * 预警通讯方式管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface WarningContactMapper extends BaseMapperX<WarningContactDO> {

    default PageResult<WarningContactDO> selectPage(WarningContactPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WarningContactDO>()
                .eqIfPresent(WarningContactDO::getType, reqVO.getType())
                .eqIfPresent(WarningContactDO::getCommunication, reqVO.getCommunication())
                .likeIfPresent(WarningContactDO::getName, reqVO.getName())
                .eqIfPresent(WarningContactDO::getTenantId,reqVO.getTenantId())
                .betweenIfPresent(WarningContactDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(WarningContactDO::getId));
    }

    default List<WarningContactDO> selectList(WarningContactExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WarningContactDO>()
                .eqIfPresent(WarningContactDO::getType, reqVO.getType())
                .eqIfPresent(WarningContactDO::getCommunication, reqVO.getCommunication())
                .likeIfPresent(WarningContactDO::getName, reqVO.getName())
                .eqIfPresent(WarningContactDO::getTenantId,reqVO.getTenantId())
                .betweenIfPresent(WarningContactDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(WarningContactDO::getId));
    }

}
